//
//  ViewController.m
//  ZFBadgeView
//
//  Created by fyzq on 2021/9/6.
//

#import "ViewController.h"
#import "UIView+ZFBadge.h"
#import "ZFBadgeStretchView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createView1];
    self.view.backgroundColor = [UIColor lightGrayColor];

    
}

-(void)createView2{
    ZFBadgeStretchView *btn = [ZFBadgeStretchView new];
    btn.translatesAutoresizingMaskIntoConstraints = NO;
    btn.text = @"9";
    btn.textColor = [UIColor whiteColor];
    btn.canDrag = YES;
//    btn.image = [UIImage imageNamed:@"ic_sign_qd_small"];
//    btn.edgeInsets = UIEdgeInsetsMake(3, 6, 3, 6);
    [self.view addSubview:btn];
    btn.completeBlock = ^{
        NSLog(@"完成");
    };
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-90-[btn]" options:0 metrics:0 views:@{@"btn":btn}]];
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-200-[btn]" options:0 metrics:0 views:@{@"btn":btn}]];
    
}

-(void)createView1{
    
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    [view zf_setBadgeAnimateViewColor:[UIColor orangeColor]];
    [view zf_setBadgeAnimateViewPosition:CGPointMake(10, 10)];
    [view zf_setBadgeAnimateViewSize:CGSizeMake(10, 10)];
//    [view zf_setBadgeAnimateViewScale:5];
    view.badgeView.canDrag = YES;
    view.badgeView.canLoogPress = YES;
    [view zf_setBadgeViewText:@"12"];
//    [view zf_setBadgeViewPosition:CGPointMake(10, 10)];
//    [view zf_setBadgeViewTextColor:[UIColor whiteColor]];
//    [view zf_setBadgeViewFont:[UIFont systemFontOfSize:14]];
//    [view zf_setBadgeViewEdgeInsets:UIEdgeInsetsMake(5, 10, 5, 10)];
//    [view zf_setBadgeViewBackgroundImage:[UIImage imageNamed:@"ic_sign_qd_small"]];
//    [view zf_setBadgeViewBackgroudColor:[UIColor orangeColor]];
    
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 240, 50, 50)];
    imageView.image = [UIImage imageNamed:@"ic_sign_ddhl"];
    [self.view addSubview:imageView];
    [imageView zf_showBadgeAnimateView];
    
}






-(void)createView{
    ZFBadgeControl *badgeControl = [ZFBadgeControl new];
    badgeControl.titleLabel.text = @"123";
    badgeControl.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:badgeControl];
    [ self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-50-[badgeControl]" options:0 metrics:0 views:@{@"badgeControl":badgeControl}]];
    [ self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-50-[badgeControl]" options:0 metrics:0 views:@{@"badgeControl":badgeControl}]];
    
    
    ZFBadgeAnimationView *badgeTipView = [ZFBadgeAnimationView new];
    badgeTipView.scale = 2.5;
    badgeTipView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:badgeTipView];
    
    [ self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-50-[badgeControl(==6)]" options:0 metrics:0 views:@{@"badgeControl":badgeTipView}]];
    [ self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-200-[badgeControl(==6)]" options:0 metrics:0 views:@{@"badgeControl":badgeTipView}]];
    
}


@end
